package com.ylbh.modules.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ylbh.common.pojo.business.dto.PrefabricatedGoodsDTO;
import com.ylbh.common.pojo.businessgoods.dto.BusinessGoods1DTO;
import com.ylbh.common.pojo.businessgoods.dto.PrefabricatedGoodsDetailsDTO;
import com.ylbh.common.pojo.businessgoods.dto.UpdateBusinessGoodsDTO;
import com.ylbh.common.pojo.businessgoods.vo.BusinessGoodsDetailsVO;
import com.ylbh.common.pojo.businessgoods.vo.BusinessGoodsListVO;
import com.ylbh.common.pojo.businessgoods.vo.PrefabricatedGoodsClassVO;
import com.ylbh.common.pojo.businessgoods.vo.PrefabricatedGoodsDetailsVO;
import com.ylbh.modules.business.entity.ShoppingBusinessGoods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 联盟店商品表
 *
 * @author czx
 * @date 2019-04-16 17:08:02
 */
@Mapper
@Repository
public interface ShoppingBusinessGoodsMapper extends BaseMapper<ShoppingBusinessGoods> {

    /**
     * 联盟店商品列表
     * @param businessGoodsListDTO
     * @param page
     * @return
     */
    List<BusinessGoodsListVO> selectBusinessGoodsList(BusinessGoods1DTO businessGoodsListDTO, Page page);

    /**
     * 未审核联盟店商品
     * @return
     */
    int selectCount();

    /**
     * 对联盟店商品进行上架操作
     * @param goodsId
     */
    void updateIsSale(@Param(value = "goodsId") Long goodsId);

    /**
     * 对联盟店商品进行下架操作
     * @param goodsId
     */
    void updateNoIsSale(@Param(value = "goodsId") Long goodsId);

    /**
     * 根据id查看联盟店的商品及商家信息
     * @param goodsId
     * @return
     */
    BusinessGoodsDetailsVO selectGoodsById(@Param(value = "goodsId") Long goodsId);

    /**
     * 对联盟店商品进行通过操作
     * @param goodsId
     */
    void updateAdopt(@Param(value = "goodsId") Long goodsId);

    /**
     * 对联盟店商品进行不通过操作
     * @param goodsId
     */
    void updateNoAdopt(@Param(value = "goodsId") Long goodsId,@Param(value = "statusRemarks") String statusRemarks);

    /**
     * 对联盟店的商品批量审核不通过操作
     * @param list
     */
    void updateBatchPassByIds(@Param(value = "list")List<String> list);

    /**
     * 对联盟店的商品批量审核不通过操作
     * @param list
     */
    void updateBatchNoPassByIds(@Param(value = "list")List<String> list);

    /**
     * 对联盟店的商品进行批量审核操作
     * @param ids
     * @param batch
     */
    void updateBatchByIds(List<String> ids, Integer batch);

    /**
     * 对联盟店的商品详情修改
     * @param updateBusinessGoodsDTO
     */
    void updateGoodsById(@Param(value = "updateBusinessGoodsDTO") UpdateBusinessGoodsDTO updateBusinessGoodsDTO);

    /**
     * 预制商品列表
     * @param prefabricatedGoodsDTO
     * @param page
     * @return
     */
    List<BusinessGoodsListVO> selectPrefabricatedGoods(@Param(value = "prefabricatedGoodsDTO") PrefabricatedGoodsDTO prefabricatedGoodsDTO, Page<Object> page);

    /**
     * 预制商品详情
     * @param goodsId
     * @return
     */
    PrefabricatedGoodsDetailsVO selectPrefabricatedGoodsById(Long goodsId);

    /**
     * 修改预制商品
     * @param prefabricatedGoodsDetailsDTO
     */
    void updatePrefabricatedGoodsById(@Param(value = "goods") PrefabricatedGoodsDetailsDTO prefabricatedGoodsDetailsDTO);

    /**
     * 新增预制商品
     * @param prefabricatedGoodsDetailsDTO
     */
    void insertPrefabricatedGoods(@Param(value = "goods") PrefabricatedGoodsDetailsDTO prefabricatedGoodsDetailsDTO);

    /**
     * 批量修改预制商品
     * @param batch
     * @param userClass
     * @param ids
     */
    void updateBatchPrefabricatedGoodsById(String batch, Integer userClass, List<String> ids);

    /**
     * 上下架预制商品
     * @param isSale
     * @param goodsId
     */
    void updateIsSaleByGoodsId(String isSale, Long goodsId);

    /**
     * 商品重新审核
     * @param goodsId
     * @param status
     * @param status1
     */
    void updateGoodsAdopt(String goodsId, Integer status, String statusRemarks);

    /**
     * 预制商品分类
     * @return
     */
    List<PrefabricatedGoodsClassVO> selectPrefabricatedGoodsClass();

    /**
     * 查询审核商品的信息
     * @param id
     * @return
     */
    ShoppingBusinessGoods selectIsCommodityBankById(String id);

    /**
     * 根据商品id查询条形码
     * @param goodsId
     */
    int selectBarCodeById(String goodsId);
}
